package com.gin.kotlin.gf2gamecommunity.viewmodel

import androidx.lifecycle.ViewModel
import com.gin.kotlin.gf2gamecommunity.base.livedata.CachedLiveData
import com.gin.kotlin.gf2gamecommunity.network.gitee.api.ReleaseApi
import com.gin.kotlin.gf2gamecommunity.network.gitee.main.GiteeRetrofit
import com.gin.kotlin.gf2gamecommunity.network.gitee.response.AppRelease

class GiteeViewModel : ViewModel() {
    private val api = GiteeRetrofit.build().create(ReleaseApi::class.java)

    val releases = CachedLiveData<List<AppRelease>, List<AppRelease>>(
        requestMethod = { api.list("AgMonk", "GF2GameCommunity") },
        bodyTransform = { it },
    )

    companion object {
        private val TAG = GiteeViewModel::class.java.simpleName
    }
}